package com.oliet.exception;

/**
 *
 * @Title: CustomException.java
 * @Description: 自定义异常类
 * @Author: Jzp
 * @Version: （版本）
 * @Date:  2023-11-26 16:04
 */
public class CustomException extends RuntimeException {

    private ErrorEnum errorCode;

    public ErrorEnum getError() {
        return errorCode;
    }

    public CustomException() {
        super(ErrorEnum.UNSPECIFIED.getMessage());
        this.errorCode = ErrorEnum.UNSPECIFIED;
    }

    public CustomException(final ErrorEnum errorCode) {
        super(errorCode.getMessage());
        this.errorCode = errorCode;
    }

    public CustomException(final ErrorEnum errorCode, final String cause) {
        super(errorCode.getMessage() + " " + cause);
        this.errorCode = errorCode;
    }


}
